const path = require("path");
function resolve(dir) {
  return path.join(__dirname, dir);
}


// 跨域配置
module.exports = {

    publicPath: '/',
    outputDir: 'dist',
    assetsDir: 'misty/static',
    lintOnSave: process.env.NODE_ENV === 'development',
    productionSourceMap: false,

    chainWebpack: config => {
        plugins: [
            require('unplugin-icons/webpack')({ /* options */ }),
        ],
        config.resolve.alias
          .set("@", resolve("src"))
          .set("assets", resolve("src/assets"))
          .set("components", resolve("src/components"))
          .set("base", resolve("baseConfig"))
          .set("public", resolve("public"));
      },

    devServer: {                //记住，别写错了devServer//设置本地默认端口  选填
        port: 9999,
        proxy: {
            '/api/fore': {              //设置拦截器  拦截器格式   斜杠+拦截器名字，名字可以自己定
                target: 'http://localhost:8090',     //代理的目标地址
                changeOrigin: true,
                logLevel:'debug',                   //是否设置同源，输入是的
                pathRewrite: {                   //路径重写
                    '^/api/fore': '/fore'                     //选择忽略拦截器里面的内容
                }
            },             //设置代理，必须填
            '/api': {              //设置拦截器  拦截器格式   斜杠+拦截器名字，名字可以自己定
                target: 'http://localhost:8080',     //代理的目标地址
                changeOrigin: true,
                logLevel:'debug',              //是否设置同源，输入是的
                pathRewrite: {                   //路径重写
                    '^/api': ''                     //选择忽略拦截器里面的内容
                }
            }
        }
    }
}
